package com.lj.infoisland.controller.admin;

/**
 * @author 龙洁
 * @description 数据统计控制层（仪表盘）
 * @create 2025-01-20 13:31
 */

import com.lj.infoisland.common.convention.result.Result;
import com.lj.infoisland.common.convention.result.Results;
import com.lj.infoisland.domain.common.CommonOption;
import com.lj.infoisland.domain.vo.BasicsDataVO;
import com.lj.infoisland.service.DataStatService;
import org.checkerframework.checker.units.qual.C;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "/admin/dataStat")
public class DataStatController {
    @Resource
    private DataStatService dataStatService;

    /**
     * 总用户、今日新增、新闻总数、评论总数
     * @return
     */
    @GetMapping(value = "/getBasicsDataStat")
    public Result<BasicsDataVO> getBasicsDataStat() {
        return Results.success(dataStatService.getBasicsDataStat());
    }

    /**
     * 用户增长趋势
     * @return
     */
    @GetMapping(value = "/getUserGrowthTrend")
    public Result<List<Integer>> getUserGrowthTrend() {
        return Results.success(dataStatService.getUserGrowthTrend());
    }

    /**
     * 新闻分类占比
     * @return
     */
    @GetMapping(value = "/getNewsCategoryProportion")
    public Result<List<CommonOption>> getNewsCategoryProportion() {
        return Results.success(dataStatService.getNewsCategoryProportion());
    }

    /**
     * 评论趋势
     * @return
     */
    @GetMapping(value = "/getCommentTrend")
    public Result<List<Integer>> getCommentTrend() {
        return Results.success(dataStatService.getCommentTrend());
    }

}
